package uk.ac.lkl.lpp.ui.xml;



import org.w3c.dom.Document;
import org.w3c.dom.Element;

import uk.ac.lkl.lpp.PedagogyPlan;

import uk.ac.lkl.lpp.xml.ElementProcessor;
import uk.ac.lkl.lpp.ui.PedagogyPlanUI;
import uk.ac.lkl.lpp.xml.XMLException;




public abstract class UIElementProcessor extends ElementProcessor {

    public UIElementProcessor(String elementName) {
        super(elementName);
    }


    @Override
    public void convertElementToData(PedagogyPlan plan, Element element)
            throws XMLException {
        PedagogyPlanUI view = plan.getUI();
        convertElementToData(view, element);
    }


    protected abstract void convertElementToData(PedagogyPlanUI view,
                                                 Element element)
            throws XMLException;


    @Override
    public final void convertDataToElements(PedagogyPlan plan,
                                            Document document,
                                            Element pedagogyPlanElement) {
        PedagogyPlanUI view = plan.getUI();
        convertDataToElements(view, document, pedagogyPlanElement);
    }


    public abstract void convertDataToElements(PedagogyPlanUI view,
                                               Document document,
                                               Element pedagogyPlanElement);

}
